package com.lablzh.gdxy.repository;

import com.lablzh.gdxy.entity.Admin;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

public interface AdminRepository extends JpaRepository<Admin, Integer> {
    Admin findAllByUsername(String username);

    @Transactional
    @Modifying
    @Query("update Admin set password=?2 where username=?1")
    void updatePasswordByUsername(String username, String newPassword);
}
